﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using Prism.Ioc;
using Prism.Unity;
using Simple_search.Views;
using Simple_search.ViewModels;
using Simple_search.Service;
using Prism.Events;

namespace Simple_search
{
    public partial class App : PrismApplication
    {
        protected override Window CreateShell()
        {
            return Container.Resolve<MainWindow>();
        }

        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterDialog<OptionWindow, OptionWindowViewModel>("option");
            containerRegistry.RegisterDialog<FinishSearchWindow, FinishSearchWindowViewModel>("finish");
            containerRegistry.RegisterSingleton<CacheManager>();
            containerRegistry.RegisterSingleton<SearchManager>();
            containerRegistry.RegisterSingleton<EventAggregator>();
        }

        protected override void OnExit(ExitEventArgs e)
        {
            base.OnExit(e);
            Container.GetContainer().Dispose();
        }
    }
}
